#/usr/bin/python
# -*- coding: utf-8 -*-

class Material():
    
    def __init__(self, _mid):
        
        self.mid = _mid
        
    def Stiffness(self):
        
        pass
    
    def Compliance(self):
        
        pass
        

class IsoMat(Material):
    """ Linear elastic isotropic material
    """
    def __init__(self,_mid,E,nu,G=None):
        
        Material.__init__(self,_mid)
        
        self.type = "ISOMAT"
        self.E = E
        self.nu = nu
        if G == None:
            print E
            print nu
            self.G = E/2./(1+nu)
        else:
            self.G = G
        
    def Stiffness(self):
        pass
        
    def Compliance(self):
        pass
        
        
class PlastIsoMat(IsoMat):
    yieldfunctions = {1:"VonMises", 2:"Tresca"}
    def __init__(self,_mid,E,nu,Re,Yf,Hr,G=None):
        
        super.__init__(self,_mid,E,nu,G=None)
        self.type = "PLASTISOMAT"
        self.Re = Re
        # yield function: {1:VonMises, 2: Tresca, 3:
        try:
            self.Yf = yeildfunctions[Yf]
        except KeyError:
            raise KeyError("selected yield function is not implemented: "+str(Yf))
        # hardening rule:
        self.Hr = Hr
    
    def Stiffness(self,strain):
        pass
        
    def Compliance(self):
        pass
        